//
//  HROrderProgressCell.m
//  haierapp
//
//  Created by gaotangzhang on 14-8-17.
//  Copyright (c) 2014年 haier. All rights reserved.
//

#import "HROrderProgressCell.h"
#import "HROrderTrackingInfo.h"

@implementation HROrderProgressCell

- (void)awakeFromNib
{
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(id)init{

    self=[[[NSBundle mainBundle]loadNibNamed:@"HROrderProgressCell" owner:self options:nil] objectAtIndex:0];
    return self;
}

-(void)configWithData:(id)data{
    HROrderTrackingInfo *trackingInfo=(HROrderTrackingInfo *)data;
    
    int state=[trackingInfo.transferState intValue];
    
    if (state==0) {
        self.pIconImageView.image=[UIImage imageNamed:@"order_ico_time"];
    }else{
        self.pIconImageView.image=[UIImage imageNamed:@"order_ico"];
    }
    
    self.pTitleLabel.text=[NSString stringWithFormat:@"%@ %@",trackingInfo.transferStop,trackingInfo.transferStateText];
    
    if (trackingInfo.operator!=nil && ![trackingInfo.operator isEqualToString:@""]) {
        
        if (trackingInfo.phone==nil || [trackingInfo.phone isEqualToString:@""]) {
            self.pDescLabel.text=[NSString stringWithFormat:@"%@:%@",trackingInfo.transferStateText,trackingInfo.operator];
        }else{
            self.pDescLabel.text=[NSString stringWithFormat:@"%@:%@(%@)",trackingInfo.transferStateText,trackingInfo.operator,trackingInfo.phone];
        }
      
    }
    
    self.pDateLabel.text=trackingInfo.transferDate;
}

@end
